--- ./src/lightdm-gtk-greeter.c.orig	2014-03-02 14:45:24.000000000 +0000
+++ ./src/lightdm-gtk-greeter.c	2014-03-07 16:58:54.000000000 +0000
@@ -139,6 +139,59 @@
 GdkPixbuf* default_user_pixbuf = NULL;
 gchar* default_user_icon = "avatar-default";
 
+const gchar *get_language_from_env (void);
+gchar *valid_utf8 (const gchar *string);
+
+const gchar *
+get_language_from_env (void)
+{
+    gchar **env;
+    const gchar *lang;
+#if defined(__linux__)
+    const gchar *default_lang = "en_US.utf8";
+#elif defined(__FreeBSD__) || defined(__DragonFly__)
+    const gchar *default_lang = "en_US.ISO8859-1";
+#endif
+
+    env = g_get_environ ();
+    lang = g_environ_getenv (env, "LANG");
+    g_strfreev (env);
+
+    if (!lang)
+        lang = default_lang;
+    else
+    {
+        if (g_strcmp0 (lang, "C") == 0 || g_strcmp0 (lang, "POSIX") == 0)
+            lang = default_lang;
+    }
+
+    return lang;
+}
+
+gchar *
+valid_utf8 (const gchar *string)
+{
+    const gchar *lang;
+    gchar **lang_info;
+    gchar *encoding;
+
+    lang = get_language_from_env ();
+    lang_info = g_strsplit_set (lang, ".@", -1);
+    encoding = g_strdup (lang_info[1]);
+    g_strfreev (lang_info);
+
+    if (g_strcmp0 (encoding, "UTF-8") == 0 || g_strcmp0 (encoding, "utf8") == 0)
+    {
+        g_free (encoding);
+        return string;
+    }
+    else
+    {
+        g_free (encoding);
+        return g_locale_to_utf8 (string, -1, NULL, NULL, NULL);
+    }
+}
+
 static void
 pam_message_finalize (PAMConversationMessage *message)
 {
@@ -2605,23 +2658,33 @@
         {
             LightDMLanguage *language = item->data;
             const gchar *country, *code;
-            gchar *label;
+            gchar *label, *modifier;
             GtkWidget *radiomenuitem;
 
             country = lightdm_language_get_territory (language);
             if (country)
-                label = g_strdup_printf ("%s - %s", lightdm_language_get_name (language), country);
+                label = g_strdup_printf ("%s - %s", valid_utf8 (lightdm_language_get_name (language)), valid_utf8 (country));
             else
-                label = g_strdup (lightdm_language_get_name (language));
+                label = g_strdup_printf ("%s", valid_utf8 (lightdm_language_get_name (language)));
                 
             code = lightdm_language_get_code (language);
-            gchar *modifier = strchr (code, '@');
+            modifier = strchr (code, '@');
             if (modifier != NULL)
             {
                 gchar *label_new = g_strdup_printf ("%s [%s]", label, modifier+1);
                 g_free (label);
                 label = label_new;
             }
+            else
+            {
+                modifier = strchr (code, '.');
+                if (modifier != NULL)
+                {
+                   gchar *label_new = g_strdup_printf ("%s [%s]", label, modifier+1);
+                   g_free (label);
+                   label = label_new;
+                }
+            }
 
             radiomenuitem = gtk_radio_menu_item_new_with_label (languages, label);
             g_object_set_data (G_OBJECT (radiomenuitem), "language-code", (gpointer) code);
